// const { ethers } = require("hardhat");
const { ethers } = require("hardhat");
async function main() {
    // 1. 获取合约实例的地址
    const DailSignAddress = "0x19c4b1c9B9Aa0543da5904BeFE88abcd1B554748"; // 替换为你实际部署后的合约地址
    
    // 2. 获取当前签名账户
    const [owner] = await ethers.getSigners();
    console.log("Deploying account:", owner.address);
  
    // 3. 获取 DailSignAddress 合约工厂
    const DailSigner = await ethers.getContractFactory("DailyCheckIn");
  
    // 4. 获取已部署合约的实例
    const dailSigner = DailSigner.attach(DailSignAddress);
    console.log("DailSigner contract address:", dailSigner.address);
  
    // 5. 调用 `getCheckInCount(address)` 方法
    const signCount = await dailSigner.getCheckInCount("0x5eaF5d7d4832E88d8bf3C0877A118ae3A1666666");
    console.log("acount sign count:", signCount);

    const signCount2 = await dailSigner.getCheckInCount(owner.address);
    console.log("acount2 sign count:", signCount2);
  
    // 6. 调用 `checkIn()` 进行签到
    // const tx = await dailSigner.checkIn();
    // await tx.wait(); // 等待交易确认
    // console.log("tx info: ", tx);
  
  }
  
  main().catch((error) => {
    console.error(error);
    process.exitCode = 1;
  });
  